
//----------
let GameApp = require('./game_app');
let Color3 = require('./color3');
let Fps = require('./fps');
let Matrix = require('./matrix');
// let Input = require('./mouseMgr');
let Node = require('./node');
let RenderItem = require('./renderItem');
let Scene = require('./scene');
let Shader = require('./shader');
let Sprite = require('./sprite');
let Texture2D = require('./texture2d');
let Vec2 = require('./vec2');
let EventEmitter = require('./event_emitter');

// Input 不需要直接暴漏
// let KeyInput = require('./input/keyInput');
// let MouseInput = require('./input/mouseInput');

//--------- utils
let myTools = require('./utils/mytools');
// let webglDebugUtil = require('./utils/webgl-debug');
// let glUtils = require('./utils/glUtils');
let shaderUtils = require('./utils/shader_uitls');
let texCache = require('./texCache');

let Keys = require('./input/keys');

// ---------- cfg
let cfg = require('./utils/cfg');

//--------------------- actions
let RepeatForever = require('./actions/repeatForever');
let SequenceAction = require('./actions/seqAction');

let move = require('./actions/move');
let MoveBy = move.MoveBy;
let MoveTo = move.MoveTo;

let rotate = require('./actions/rotate');
let RotateTo = rotate.RotateTo;
let RotateBy = rotate.RotateBy;

let scale = require('./actions/scale');
let ScaleTo = scale.ScaleTo;
let ScaleBy = scale.ScaleBy;

let DelayTime = require('./actions/delayTime');
let Spawn = require('./actions/spawn');


let dd = {
    GameApp:GameApp,
    Color3:Color3,
    Fps:Fps,
    Matrix:Matrix,
    // Input:Input,
    Node:Node,
    RenderItem:RenderItem,
    Scene:Scene,
    Shader:Shader,
    Sprite:Sprite,
    Texture2D:Texture2D,
    Vec2:Vec2,
    v2(x,y){
        return new Vec2(x,y);
    },

    EventEmitter:EventEmitter,

    //----
    myTools:myTools,
    // webglDebugUtil:webglDebugUtil,
    // glUtils:glUtils,
    shaderUtils:shaderUtils,
    texCache:texCache,
    cfg:cfg,
    Keys:Keys,

    //---------actions:
    // RotateBy:RotateBy,
    rotateBy(duration,angle){
        return  new RotateBy(duration,angle);
    },

    rotateTo(duration,angle){
        return  new RotateTo(duration,angle);
    },

    repeatForever(action){
        return new RepeatForever(action);
    },

    sequence(tempArray){
        let actions;
        if(Array.isArray(tempArray)){
            actions = tempArray;
        }else{
            actions = Array.prototype.slice.call(arguments,0);
        }
        return new SequenceAction(actions);
    },

    moveBy(duration,dx,dy){
        return new MoveBy(duration,dx,dy);
    },

    moveTo(duration,dx,dy){
        return new MoveTo(duration,dx,dy);
    },

    scaleTo(duration,sx,sy){
        return new ScaleTo(duration,sx,sy);
    },

    scaleBy(duration,sx,sy){
        return new ScaleBy(duration,sx,sy);
    },

    delayTime(t){
        return new DelayTime(t);
    },

    spawn(tempArray){
        let actions;
        if(Array.isArray(tempArray)){
            actions = tempArray;
        }else{
            actions = Array.prototype.slice.call(arguments,0);
        }
        return new Spawn(actions);
    },

    log:function () {
        console.log(... arguments);
    }
};

module.exports = dd;
